Before we can process any commands, we need to set up our program and data structures.
Guidance for Step 1
- Import `deque`: We'll need this for an efficient queue in our BFS implementation later.
- Read U and N: Read the number of users and operations from the first line of input.
- Adjacency List: For `U` users, we need a list containing `U` empty lists. `adj[i]` will store the users that user `i` follows.
- Your Task: Fill in the blank to correctly initialize the `adj` list. What syntax creates a new, empty list?
# We'll need a queue for BFS
from collections import deque
# Read the first line: U (Users) and N (Operations)
u_line, n_line = input().split()
U = int(u_line)
N = int(n_line)
# Initialize the adjacency list
# We need a list of U empty lists
adj = [ ______ for _ in range(U) ]
Copied!